const { default: axios } = require("axios")
const {appid,secret}=require('../env')
const {CODE_IS_ERROR}=require('../error/errorType')

class wxpayController{
    async getAccessTokenFun(ctx,next){
        const {code}=ctx.request.body
        let res=await axios(`https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`)
        console.log(res)
        ctx.mesg="获取成功"
        ctx.body=res
        await next()
    }
}

module.exports=new wxpayController()